package mahjong;


/**
 * A class to represent the game player.  This class contains the main control
 * flow for receiving player actions and dispatching them into the game.
 */
public class Player
{
	private Viewer viewer;
	private Board board;

	/** Default Player constructor. */
	public Player() { }

	/** Set the viewer representing the player's view of the board.
	 * @param v the viewer.
	 */
	public void setView(Viewer v)
	{
		viewer = v;
	}

	/** Set the board that the player is playing.
	 * @param b the board.
	 */
	public void setBoard(Board b)
	{
		board = b;
	}

	/** Main player control flow. */
	public void play() {
		//Check to make sure board && viewer are not null
	}

	/** The player selects a tile.
	 * @param t the tile to be selected.
	 */
	public void selectTile(Tile t)
	{
		board.makeMove(t);
		viewer.updateUI();
		if(board.isEmpty())
		{
			HighScoreHandler.saveHighScore(board.getBName(), viewer, GameTime.timeToInt());
		}
	}

}
